﻿using MediatR;
using System.Numerics;
using T.Personnel.Domain;
using T.Personnel.Domain.Dto;
using T.Personnel.Read.API.Application.Command.RegisterCommand;
using T.Personnel.Repository.Interface;

namespace T.Personnel.Read.API.Application.CommandHandler.RegisterHandler
{
    public class GetListRegisterHandler:IRequestHandler<GetListRegisterCommand, Result<Register>>
    {
        private readonly IRegisterRepository registerRepository;

        public GetListRegisterHandler(IRegisterRepository registerRepository)
        {
            this.registerRepository = registerRepository;
        }

        public async Task<Result<Register>> Handle(GetListRegisterCommand request, CancellationToken cancellationToken)
        {
            return await registerRepository.GetRegisterAsync(request.Name, request.DepartmentId, request.PositionId, request.Phone, request.EmployeeType, request.PageIndex, request.PageSize);
        }
    }
}
